home *** CD-ROM | disk | FTP | other *** search
- /*
- *
- * Subject:
- * ========
- * ALynx copy stripper for DOWNLOADER: option
- *
- * Problem:
- * ========
- * Since the DOWNLOADER: option in Lynx.cfg only accepts
- * two placeholders ("%s") whereas the first one stands
- * for the sourcefile with a name like "T:L1285968800.html"
- * and the second for the filename supplied by the user.
- * The problem arises from the fact that the second place
- * holder will be quoted. Ex.: user supplied 'FOOBAR.lha'
- * the command will be filled as:
- *
- * copy quiet T:L1285968800.html "FOOBAR.lha" >NIL:
- *
- * This is a problem, if someone wants to set up different
- * pathes. Defining something like
- *
- * DOWNLOADER:Save to SYS\:Tools/:copy quiet %s SYS:Tools/%s >NIL\::TRUE
- *
- * would result in
- *
- * copy quiet T:L1285968800.html SYS:Tools/"FOOBAR.lha" >NIL:
- *
- * which would create a filename with the quote-chars ('"') surrounded.
- *
- * Solution:
- * =========
- * Define a new DOWNLOADER: entry which calls copystripper.rexx
- * (Here: saves to ARC:tmp/ directory)
- *
- * DOWNLOADER:Save to ARC\:tmp/:rx goodies/copystripper.rexx %s %s ARC\:tmp/ >NIL\::TRUE
- *
- * Arguments for copystripper.rexx:
- *
- * copystripper FROM_NAME DESTINATION_NAME DESTINATION_DIRECTORY
- * ^ ^ ^
- * | | |
- * | | +-- supplied by DOWNLOADER: [lynx.cfg]
- * | |
- * | +-- supplied by second %s (quoted) [Userinput]
- * |
- * +-- supplied by first %s [ALynx]
- *
- * Author:
- * =======
- * Peter Marquardt, wwwutz@tfh-berlin.de || marquardt_p@rz-berlin.de
- *
- * Status:
- * =======
- * See SUCKS license 8)
- */
-
- address arexx
-
- parse arg fromname toname todirectory .
-
- /*
- * strip quotes
- */
-
- tonew = strip(toname,B,'"')
-
- /*
- * strip other chars which might slip through the primitive
- * ALynx filename-security.
- */
-
- tonew = compress(tonew,"/:`'[]#?()|")
-
- /* create new destinationpath with quotes */
- dest = '"'todirectory||tonew'"'
-
- /* create new commandline */
- cmd = "COPY QUIET "fromname" TO "dest" >NIL:"
-
- /* copy the file */
- address command cmd
- exit
-
- /* Remember: Trivial problems require HUGE scripts 8) */
-
-